let Level = require('Level');
let soundMgr = require('soundMgr');
let dragons = require('dragons');
let nodeMgr = require('nodeMgr');
let sounds = require('sounds');
let eventsMgr = require('eventsMgr');
let actions = require('actions');
var levelMgr = require('levelMgr');
cc.Class({
    extends: Level,

    properties: {
        nextLevelId:1,
    },
    // LIFE-CYCLE CALLBACKS:
    start () {

    },
    /**
     * 开始关卡
     */
    startLevel(){
        //从这里开始做小步的动画
        let self = this;
        cc.log('秒后开始播放声音');
        //跳入的小步节点
        this.xiaobujun = this.node.getChildByName("bg").getChildByName("xiaobujun1");
        //说话的小步节点
        this.xiaobujun2 = this.node.getChildByName("bg").getChildByName("xiaobujun2");
        //赋值黑板的节点
        this.blackboard = this.node.getChildByName("bg").getChildByName("blackboard");

        //加载下个场景
        soundMgr.playSoundEffectByName(sounds.SHIPIN_LICHANG, () => {
            self.xiaobujun.getComponent(dragonBones.ArmatureDisplay).timeScale = 0.8;
            self.xiaobujun.active = true;
            self.xiaobujun2.active = false;
            soundMgr.playSoundEffectByName(sounds.JUMP_OUT);
            dragons.playAnimation(self.xiaobujun, "JumpOff", 1,function () {
                self._nextLevel();
            });
        });
    },
    /**
     * 切换到下一关
     * @private
     */
    _nextLevel(){
        let self = this;
        self.loadLevel(1);
    },
});
